<template>
    <ul class="list-group">
        <li class="list-group-item">新闻id：{{ route.params.newsId }}</li>
        <li class="list-group-item">新闻内容：{{ route.query.content }}</li>
        <li class="list-group-item">新闻类型：{{ typeObj?.type }}</li>
    </ul>
</template>

<script setup lang="ts">
import { ref, computed } from 'vue'
import { useRoute } from 'vue-router';
const route = useRoute()
const typeList = ref([
    { id: 11, type: '国内新闻' },
    { id: 22, type: '国际新闻' },
    { id: 33, type: '娱乐新闻' },
    { id: 44, type: '娱乐新闻' },
    { id: 55, type: '娱乐新闻' },
])
const typeObj = computed(() => {
    return typeList.value.find(item => String(item.id) == route.params.newsId)
})
</script>

<style scoped>

</style>